<?php

class NewsController extends Controller{
	
	public $models = array("News");
	
	public function index(){
		
		$this->assign("title",$this->template_parser->get_config_vars("news"));
		
		$news = $this->News->find();
		$this->translate($news, "news");
		
		$this->News->shorten($news);
		$this->assign("news", $news);
		
		$this->description = $this->template_parser->get_config_vars("_description_news");
		
		$this->display("news/index.html");
	}
	
	public function show($id, $title) {
		$news = $this->News->findRow("*", array("id"=>$id));
		$this->translateRow($news, "news");
		
		$this->News->shorten($news);
		$this->description = trim(preg_replace('/(\r*\n)+/', " ", html_entity_decode(strip_tags($news["body_short"]), ENT_QUOTES, "UTF-8")));
		
		$this->assign("title",$news["title"]);
		
		$this->title = $this->template_parser->get_config_vars("news") . " {$this->title_delimiter} " . $news["title"];
		
		$this->assign("news", $news);
		
		$this->display("news/show.html");
	}
}

?>